<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>
    
<%@ taglib prefix="core" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<head>
	<meta charset="utf-8">
	<title>jQuery UI Datepicker - Default functionality</title>
	<link rel="stylesheet" href="/MamNet/css/jquery.ui.all.css">
	<script src="/MamNet/js/jquery-1.7.1.js"></script>
	<script src="/MamNet/js/ui/jquery.ui.core.js"></script>
	<script src="/MamNet/js/ui/jquery.ui.widget.js"></script>
	<script src="/MamNet/js/ui/jquery.ui.datepicker.js"></script>
	<link rel="stylesheet" href="/MamNet/css/demos.css">
	<script>
	$(function() {
		$( "#datepicker" ).datepicker({
			changeMonth: true,
			changeYear: true
		});
	});
	</script>
</head>

<%@ page import="com.net.domain.UserType,com.net.domain.User" %>


<form method="POST" name="student" action="/MamNet/user/updateDetails">
<input type="hidden" name="first" value="${first }"/>

	<table>
		<tr><td>User Name : </td><td></td><td><input type="text" name="user_name" value="${user.userName}" readonly="readonly"/></td></tr>
		<tr><td>Title : </td><td></td><td><select name="title"><option value="Mr">MR</option><option value="Ms">MISS</option><option value="Mrs">MRS</option>
</select></td></tr>
		<tr><td>First Name: </td><td></td><td><input type="text" name="first_name" value="${user.firstName}"/></td> <td><font color="red"><form:errors path="name"/></font></td> </tr>
		<tr><td>Middle Name : </td><td></td><td><input type="text" name="middle_name" value="${user.middleName }" /></td></tr>
		<tr><td>Last Name : </td><td></td><td><input type="text" name="last_name" value="${user.lastName }"/></td></tr>
		<tr><td>Gender : </td><td></td><td><input type="radio" name="gender" value="m" <% if(((User)request.getAttribute("user")).getGender().equalsIgnoreCase("m")) { %> checked <% } %> /> Male<br />
<input type="radio" name="gender" value="f" <% if(((User)request.getAttribute("user")).getGender().equalsIgnoreCase("f")) { %> checked <% } %> /> Female   </td></tr>
		<tr><td>DOB : </td><td></td><td><input type="text" name="dob" value="${user.dob}" id="datepicker"/>
			<td><font color="red"><form:errors path="dob"/></font></td>
			
	     				</tr>
		<tr><td>Primary Email : </td><td></td><td><input type="email" name="primary_email" value="${user.primaryEmail }"/></td></tr>
		<tr><td>Secondary Email : </td><td></td><td><input type="text" name="secondary_email" value="${user.secondaryEmail }"/></td></tr>
		<tr><td>Mobile No : </td><td></td><td><input type="text" name="mobile_no" value="${user.mobileNo }"/></td></tr>
		<tr><td>Land Line No : </td><td></td><td><input type="text" name="land_line_no" value="${user.landLineNo }"/></td></tr>
		<tr><td>Communication Address : </td><td></td><td><textarea cols="40" rows="5" name="communication_address" value="${user.communicationAddress}">${user.communicationAddress}</textarea></td></tr>
		
<%
User user=(User)request.getAttribute("user");
if(user.getUserType() == UserType.STUDENT.getUserType()) {
	%>

		<tr><td>Register no : </td><td></td><td><input type="text" name="register_no" value="${user.registerNo }"/></td></tr>
		<tr><td>roll no : </td><td></td><td><input type="text" name="roll_no" value="${user.rollNo }"/></td></tr>
		<%}
%>		
<%
if (user.getUserType() == UserType.STAFF.getUserType()) {
	%>

<%-- 		<tr><td>Staff ID</td><td></td><td><input type="text" name="staff_Id" value="${user.staffId }"/></td></tr> --%>
		
		<%}
%>		
		<tr><td></td><td><input type="submit" value="Update" /></td></tr>
	</table>
	
	
</form>
